<?PHP
#
#   FILE:  Unsubscribe.php (Blog plugin)
#
#   Part of the Metavus digital collections platform
#   Copyright 2013-2020 Edward Almasy and Internet Scout Research Group
#   http://metavus.net
#

use Metavus\User;

# ----- MAIN -----------------------------------------------------------------

PageTitle("Unsubscribe from blog entry notifications");

# get the blog plugin
$Blog = $GLOBALS["G_PluginManager"]->GetPluginForCurrentPage();
$Blog->SetCurrentBlog($Blog->ConfigSetting("EmailNotificationBlog"));

# change the subscription for the user
$Blog->ChangeNotificationSubscription(User::getCurrentUser(), false);

# go back to the blog landing page
$GLOBALS["AF"]->SetJumpToPage($Blog->BlogUrl());
